package com.example.netcamerastreamdemo

import android.Manifest
import android.os.Build
import android.os.Bundle
import android.view.SurfaceView
import android.widget.Button
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.example.netcamerastreamdemo.flvplayer.FlvStreamPlayer

class FlvPlayerActivity : AppCompatActivity() {
    private val TAG = "FlvPlayerActivity"

    lateinit var mSurfaceView: SurfaceView
    lateinit var testBtn : Button
    lateinit var player : FlvStreamPlayer

    @RequiresApi(Build.VERSION_CODES.M)
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main2)
        mSurfaceView = findViewById(R.id.surface_view)
        testBtn = findViewById(R.id.button5)
        testBtn.setOnClickListener {
            player.play()
        }
        player = FlvStreamPlayer(this, mSurfaceView.holder.surface)

        requestPermissions(arrayOf(
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.WRITE_EXTERNAL_STORAGE
        ), 0);
    }


}